Skip to content

fix[mono]: fix files-changed invalid after mr merged#1097

Merged
genedna merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main
Jun 5, 2025
Merged

fix[mono]: fix files-changed invalid after mr merged#1097
genedna merged 1 commit into
gitmono-dev:mainfrom
benjamin-747:main

Conversation

@benjamin-747

Copy link
Copy Markdown
Collaborator

No description provided.

@vercel

vercel Bot commented Jun 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 5, 2025 8:05am

@benjamin-747 benjamin-747 changed the title fix{mono}: fix files-changed invalid after mr merged fix[mono]: fix files-changed invalid after mr merged Jun 5, 2025
@benjamin-747
benjamin-747 requested a review from genedna June 5, 2025 08:15
@genedna
genedna requested a review from Copilot June 5, 2025 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes invalid file-change detection after merge requests and refactors storage and pack routines for better reliability and performance.

  • Rename and enhance remove_refs to filter out non-MR refs and update its usage in the API service.
  • Refactor batch-saving routines to use concurrent execution (try_join_all) and improve GitDbStorage’s error propagation.
  • Add a migration to alter the unique index on MegaMr, unify full_pack with incremental_pack, and introduce controlled concurrency and error logging in import routines.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
jupiter/src/storage/mono_storage.rs Renamed remove_refs to remove_none_mr_refs and added MR filter
jupiter/src/storage/mod.rs Made batch_save_model_with_conflict private and switched to try_join_all
jupiter/src/storage/git_db_storage.rs Replaced multiple unwrap() calls with ? for batch saves
jupiter/migration/src/m20250605_013340_alter_mega_mr_index.rs Created migration to drop old MR index and add new unique composite
jupiter/migration/src/lib.rs Registered the new migration
ceres/src/pack/monorepo.rs Simplified full_pack by delegating to incremental_pack
ceres/src/pack/import_repo.rs Added semaphore for parallel saves, reduced chunk size, added logging, removed dead code
ceres/src/api_service/mono_api_service.rs Updated ref-removal call, improved error handling for libra diff
Comments suppressed due to low confidence (2)

jupiter/src/storage/mono_storage.rs:74

  • [nitpick] The function name remove_none_mr_refs is ambiguous and contains a typo. Consider renaming it to remove_non_mr_refs or remove_non_merge_refs for clarity.
pub async fn remove_none_mr_refs(&self, path: &str) -> Result<(), MegaError> {

jupiter/migration/src/m20250605_013340_alter_mega_mr_index.rs:29

  • The down migration is a no-op and does not revert the index changes made in up. Consider dropping the new index and recreating the old one to fully support rollback.
async fn down(&self, _: &SchemaManager) -> Result<(), DbErr> {

.unwrap();
// remove refs start with path
storage.remove_refs(&mr.path).await.unwrap();
// remove refs start with path exceprt mr type

Copilot AI Jun 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: exceprt should be except.

Suggested change
// remove refs start with path exceprt mr type
// remove refs start with path except mr type

Copilot uses AI. Check for mistakes.
) -> Result<Option<Commit>, GitError> {
let storage = self.context.services.git_db_storage.clone();
let mut entry_list = vec![];
let semaphore = Arc::new(Semaphore::new(8));

Copilot AI Jun 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The semaphore limit 8 is a magic number. Extract it into a named constant or configuration to clarify its purpose and make it configurable.

Suggested change
let semaphore = Arc::new(Semaphore::new(8));
let semaphore = Arc::new(Semaphore::new(SEMAPHORE_LIMIT));

Copilot uses AI. Check for mistakes.
Comment on lines +152 to +157
// let mut blob_handler = vec![];
for chunk in bids.chunks(1000) {
let raw_storage = raw_storage.clone();
let sender_clone = entry_tx.clone();
let chunk_clone = chunk.to_vec();
let handler = tokio::spawn(async move {
let mut blob_stream =
raw_storage.get_raw_blobs_stream(chunk_clone).await.unwrap();
while let Some(model) = blob_stream.next().await {
match model {
Ok(m) => {
// todo handle storage type
let b: Blob = m.into();
let entry: Entry = b.into();
sender_clone.send(entry).await.unwrap();
}
Err(err) => eprintln!("Error: {:?}", err),
// let handler = tokio::spawn(async move {

Copilot AI Jun 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There are several commented-out blocks related to blob handling. Remove or restore this code to reduce clutter and improve readability.

Copilot uses AI. Check for mistakes.
@genedna
genedna added this pull request to the merge queue Jun 5, 2025
Merged via the queue into gitmono-dev:main with commit a077021 Jun 5, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants